﻿<?php require_once('Connections/STN.php'); ?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") 
{
  if (PHP_VERSION < 6) {
    $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
  }

  $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);

  switch ($theType) {
    case "text":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;    
    case "long":
    case "int":
      $theValue = ($theValue != "") ? intval($theValue) : "NULL";
      break;
    case "double":
      $theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
      break;
    case "date":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;
    case "defined":
      $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
      break;
  }
  return $theValue;
}
}
//conversor de data
	function bancobr($databanco){
		$ano = substr($databanco, 0, 4);
		$mes = substr($databanco, 5, 2);
		$dia = substr($databanco, 8, 2);
		$databr = $dia . "/" . $mes . "/" . $ano;
		return $databr;
	}
$codigo=$_GET['codigo'];
mysql_select_db($database_STN, $STN);
$query_RSdocumento = "SELECT * FROM tb_arquivos WHERE ARQ_CODIGO='$codigo'";
$RSdocumento = mysql_query($query_RSdocumento, $STN) or die(mysql_error());
$row_RSdocumento = mysql_fetch_assoc($RSdocumento);
$totalRows_RSdocumento = mysql_num_rows($RSdocumento);
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<link rel="stylesheet" href="css/style.css" type="text/css" >
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Documento sem título</title>
</head>

<body>

<div style="width:600px;">
<h3><?php echo $row_RSdocumento['ARQ_NOME'] ?> </h3>
<!--abri o arquivo-->
<div><a href="arquivos/<?php echo $row_RSdocumento['ARQ_CODIGO'] ?>.pdf" target="_blank" style="text-decoration:none; color:#000"><img src="imagens/pdf.png" width="25" height="25" style="float:left;	margin: 0px;" border="0" />Abri Arquivo</a>
<!--data-->
<div class="data"><?php echo bancobr($row_RSdocumento['ARQ_DATA_CADASTRO']) ?></div>
<!--botão curti-->
<iframe src="http://www.facebook.com/plugins/like.php?href=http://www.asaladotionaldinho.com.br/documentos.php
&amp;send=true&amp;layout=standard&amp;width=450&amp;show_faces=true
&amp;action=like&amp;colorscheme=light&amp;font&amp;height=80" scrolling="no" frameborder="0"
style="border:none; overflow:hidden; width:450px; height:30px;" allowTransparency="true"></iframe></div>
<hr class="pontilhada" />
<?php echo $row_RSdocumento['ARQ_DESCRICAO'] ?>

</div>


</body>
</html>
<?php
mysql_free_result($RSdocumento);
?>
